<template>
    <div>
        <button @click = "handlerHello">调用hello</button>
    </div>
</template>

<script>
    import axiosApi from '@/api/axios'
    export default {
        name: "Axios",
        data() {
            return {
            }
        },
        methods: {
            async handlerHello() {
                // 调用后台会抛出异常
                await axiosApi.hello().catch(error=>{

                });

                console.info("==============1===================")
                try {
                    await axiosApi.hello("hello");
                } catch (err) {
                }

                console.info("===============2==================")
                try {
                    axiosApi.hello("hello");
                } catch (err) {
                }
            }
        }
    }
</script>

<style scoped>

</style>